package com.zangchat.controller;

import java.util.List;

import com.common.core.controller.BaseController;
import com.common.core.domain.AjaxResult;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.zangchat.domain.ChatConcernusers;
import com.zangchat.service.IChatConcernusersService;

/**
 * 用户关注Controller
 * 
 * @author wudi
 * @date 2020-07-15
 */
@RestController
@RequestMapping("/zangchat/concernusers")
public class ChatConcernusersController extends BaseController
{


    @Autowired
    private IChatConcernusersService chatConcernusersService;

    /**
     * 关注
     * @param userId 关注用户id
     * @param toUserId 被关注用户id
     * @return
     */
    @PostMapping("/doConcern")
    public AjaxResult doConcern(Long userId,Long toUserId){
       return chatConcernusersService.doConcern(userId,toUserId);
    }

    /**
     * 取消关注
     * @param userId 关注用户id
     * @param toUserId 被关注用户id

     * @return
     */
    @PostMapping("/restConcern")
    public AjaxResult restConcern(Long userId,Long toUserId){
        return chatConcernusersService.restConcern(userId,toUserId);
    }

    /**
     * 拉黑
     * @param userId 用户id
     * @param toUserId 被拉黑用户id

     * @return
     */
    @PostMapping("/changeBlack")
    public AjaxResult changeBlack(Long userId,Long toUserId) {
        return chatConcernusersService.changeBlack(userId, toUserId);
    }

    /**
     * 取消拉黑
     * @param userId 用户id
     * @param toUserId 被拉黑用户id

     * @return
     */
    @PostMapping("/restChangeBlack")
    public AjaxResult restChangeBlack(Long userId,Long toUserId){
        return chatConcernusersService.restChangeBlack(userId,toUserId);
    }

    /**
     * 关注列表
     * @param userId 关注用户id
     * @param
     * @return
     */
    @PostMapping("/selectChatConcernusersByUserId")
    public AjaxResult selectChatConcernusersByUserId(Long userId, int pageNum,int pageSize) {

        return chatConcernusersService.selectChatConcernusersByUserId(userId,pageNum,pageSize);
    }

    /**
     * 粉丝列表
     * @param userId 关注用户id
     * @param
     * @return
     */
    @PostMapping("/selectFansListByToUserId")
    public AjaxResult selectFansListByToUserId(Long userId, int pageNum,int pageSize) {
        return chatConcernusersService.selectFansListByToUserId(userId,pageNum,pageSize);
    }

    /**
     * 黑名单列表
     * @param userId 关注用户id
     * @param
     * @return
     */
    @PostMapping("/selectBlackListByUserId")
    public AjaxResult selectBlackListByUserId(Long userId, int pageNum,int pageSize) {
        return chatConcernusersService.selectBlackListByUserId(userId,pageNum,pageSize);
    }
}
